﻿@{
    Layout = "~/Views/Shared/_PopupLayout.cshtml";
}

@model LineOfBusiness.Poco.SR_tblSalesOrders

@Html.LOBHtmlHelper().Busy("pupopBusy")
@{Html.LOBHtmlHelper().tdLable("80");}

<style> 
 fieldset {
    margin: 8px;
    border: 1px solid silver;
    padding: 8px;    
    border-radius: 4px;
}
legend{
    padding: 2px;        
}
</style>
 
<div>
    <form id="frm">
        <table style="width:100%;padding-left:15px;padding-right:15px">
            <tr>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblSONo", "SONo")
                </td>
                <td >
                    @Html.LOBHtmlHelper().InputFor("SONo", InputType.Text,1)
                </td>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblSODate", "SODate")
                </td>
                <td>
                    @Html.LOBHtmlHelper().InputFor("SODate", InputType.Text, 1)
                </td>
            </tr>
        
            <tr>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblSOStatus", "SOStatus")
                </td>
                <td>
                    @Html.LOBHtmlHelper().ComboBoxFor("SOStatus", "L0002", 0, new { style = "width:100%" })
                </td>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblCustomerID", "CustomerID")
                </td>
                <td>
                    @Html.LOBHtmlHelper().ComboBoxFor("CustomerID", "tblCustomers", 0, new { style = "width:100%" })
                </td>
            </tr>

            <tr>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblCurrencyID", "CurrencyID")
                </td>
                <td>
                    @Html.LOBHtmlHelper().ComboBoxFor("CurrencyID", "tblForeignCurrList", 0, new { style = "width:100%" })
                </td>
                <td class="tdLabel">
                    @Html.LOBHtmlHelper().Label("lblDeadlines", "Deadlines")
                </td>
                <td>
                    @Html.LOBHtmlHelper().InputFor("Deadlines", InputType.Text, 1)
                </td>
            </tr>
            <tr>
                <td colspan="4">
                    <table cellpadding="1" cellspacing="1" style="table-layout:fixed;width:100%">
                        <tr>
                            <td>
                                @Html.LOBHtmlHelper().GridView("grvtblSalesOrdersLines", "tblSalesOrdersLines", "SR_tblSalesOrdersLines", true, false, new { @style = "width: 100%;height:220px" }, "SONo", @Model.SONo, false, false, "", true, true)
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>

        <div id="_blank" style="height:0px"></div>
    </form>
</div>

<div class="Line">
</div>

<div  style="text-align:right">
    <div class="buttons">
        @if(ViewBag.Edit!=-1)
        {
            <button id="btnSave" class="positive" onclick= "SavePopup()">
                <img src="@Html.BaseUrl()Content/images/toolbar/save.png" alt="" /> 
                @Html.LOBHtmlHelper().C("Save") 
            </button> 
        }
        <button class="positive" onclick= "Close()">
            <img src="@Html.BaseUrl()Content/images/toolbar/close.png" alt="" /> 
            @Html.LOBHtmlHelper().C("Close")
        </button> 
    </div>
</div>

<script type="text/javascript">

    var codeBasePopup = new CodeBasePopup();

    $(document).ready(function () {

        codeBasePopup.init('@ViewBag.Edit', "SONo", "@Url.Action("Save", "SalesOrders")", '@Model.SONo', "grvtblSalesOrdersLines", -1,-1);

        codeBasePopup.SetEntityDetail('SR_tblSalesOrdersLines');

        setTimeout(function () { $("#SONo").focus(); }, 500);

    });

    function SavePopup() {
        codeBasePopup.SavePopup();
    }

    function Add_record() {
        codeBasePopup.Add_record();
    }


    function Delete_record() {
        codeBasePopup.Delete_record();
    }

    function Close() {
        codeBasePopup.Close();
    }

</script>